Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use per-device locks to update resource status #123

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nicelhc13
Copy link
Contributor

This PR uses per-device locks to update resource status.
This PR requires CPU core modes to see performance improvements; do git checkout cpu-test -- parla/cpu_impl.py.
It improved 3x faster runtime compared to the main.

@nicelhc13 nicelhc13 requested a review from wlruys April 28, 2022 05:16
# Parla tracks managed PArrays' locations
# Index into dict with id(array), then with device. True means the array is present there
# We use the unique id of the array as the key because PArray is an unhashable class
self._managed_parrays = {}

@staticmethod
def _initial_resources():
return {dev: {name: amt for name, amt in dev.resources.items()} for dev in get_all_devices()}
res_dict = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to give index; individual lock exists for each device. But I have no idea how to write it in more pythonic way :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants